package com.offcn.controller;

import com.offcn.entity.Enquiry;
import com.offcn.entity.User;
import com.offcn.service.EnquiryService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Date;

@Controller
public class EnquiryController {
    @Resource
    private EnquiryService enquiryService;

    @RequestMapping(value = "/enquiry")
    public String enquiry(@RequestParam(value="details",required=false) String details, HttpSession session){


        int num=enquiryService.insertEnquiry(""+new Date(),((User)session.getAttribute("user")).getUid(),details);

        return "enquiry";
    }

    @RequestMapping(value = "/showEnquiry")
    public String showEnquiry(){

        return "enquiry";
    }

}
